package com.aiit.ssm.controller;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aiit.ssm.model.Department;
import com.aiit.ssm.model.ProcResult;
import com.aiit.ssm.service.DepartmentService;

@Controller
@RequestMapping("/dept")
public class DepartmentController {

	@Autowired
	DepartmentService deptService;
	
	//查询所有部门
	
	@RequestMapping("/findAllDepts")
	@ResponseBody	
	public ProcResult findAllDepts() {
		System.out.println("findAllDepts");
		List<Department> deptList = deptService.findAllDepts();
		return ProcResult.success().bind("deptList", deptList);
		
	}
	
	@RequestMapping("/findEmpNums")
	@ResponseBody
	public Map<String, Object> countEmp() {
		System.out.println("findEmpNums。。。");
		Map<String, Object> baseMap =new HashMap<String,Object>();
		
		List<Map<String, Object>> baseList  = deptService.findEmpNum();
		System.out.println(baseList);	
		baseMap.put("data", baseList);
		
		    return baseMap;
		
	}
	
}
